import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Customer } from 'src/app/domain/customer';

@Injectable({
  providedIn: 'root'
})
export class CustomerService {
  constructor(private http: HttpClient) {}

  getCustomersSmall() {
    return this.http
      .get<any>('assets/showcase/data/customers-small.json')
      .toPromise()
      .then((res) => res.data as Customer[])
      .then((data) => {
        return data;
      });
  }

  getCustomersMedium() {
    return this.http
      .get<any>('assets/showcase/data/customers-medium.json')
      .toPromise()
      .then((res) => res.data as Customer[])
      .then((data) => {
        return data;
      });
  }

  getCustomersLarge() {
    return this.http
      .get<any>('assets/showcase/data/customers-large.json')
      .toPromise()
      .then((res) => res.data as Customer[])
      .then((data) => {
        return data;
      });
  }

  getCustomersXLarge() {
    return this.http
      .get<any>('assets/showcase/data/customers-xlarge.json')
      .toPromise()
      .then((res) => res.data as Customer[])
      .then((data) => {
        return data;
      });
  }
}
